home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 3 / BBS in a box - Trilogy III.iso / Files / Prog / U-Z / VideoToolBox Folder / Utilities / GrabDrivers / AddResourceToFile.c next >
Encoding:
C/C++ Source or Header  |  1993-02-23  |  1.0 KB  |  32 lines  |  [TEXT/KAHL]

  1. #include "VideoToolbox.h"
  2. #include <Errors.h>
  3. #include <Files.h>
  4. #include <Resources.h>
  5. void AddResourceToFile(unsigned char *filename,unsigned char *name,ResType type,int id,Handle handle);
  6.  
  7. void AddResourceToFile(unsigned char *filename,unsigned char *name,ResType type,int id,Handle handle)
  8. {
  9.     OSErr error;
  10.     ResType myResType;
  11.     short RefNo;
  12.     int i;
  13.     FInfo outFileInfo;
  14.  
  15.     if(handle==NULL)return;
  16.     CreateResFile(filename);
  17.     GetFInfo(filename,0,&outFileInfo);
  18.     outFileInfo.fdType = 'rsrc';    // resource
  19.     outFileInfo.fdCreator = 'RSED';    // ResEdit
  20.     SetFInfo(filename,0,&outFileInfo);
  21.     RefNo = OpenResFile(filename);
  22.     if(RefNo == -1)PrintfExit("Can't create file!\007\n");
  23.     AddResource(handle,type,id,name);
  24.     i=ResError();
  25.     if(i != 0) printf("AddResource error %d\007, ",i);
  26.     if(i == resNotFound) printf("resource not found.\n");
  27.     if(i == resFNotFound) printf("resource file not found.\n");
  28.     if(i == addResFailed) printf("add resource failed.\n");
  29.     if(i == rmvResFailed) printf("remove resource failed.\n");
  30.     CloseResFile(RefNo);
  31. }
  32.